﻿#include "NetNpcHandler.h"
#include "MapScene.h"

#include "NetMsgHandler.h"

#include "CreatureManager.h"

#include "MapManager.h"
#include "NpcManager.h"

#include "GameDanger.h"



RECV_MSG_TALK_NPC gMsgTalkNpc;


fint32				NetTalkNpcHandler( GamePlayer* player , netMsgHead* head )
{
    CHECKMSG( SEND_MSG_TALK_NPC )

	MapScene* scene = gMapManager->GetScene( player->GetMoveData().Pos.MapID );

	if ( !scene )
	{
		return GAME_NO_ERROR;
	}

	if ( player->GetTeam() )
	{
		if ( !player->GetTeam()->IsLeader( player ) )
		{
			return GAME_NO_ERROR;
		}
	}

	GameNpc* npc = scene->GetNpc( msg->ID );

	if ( npc )
	{
		if ( player->GetMoveData().Pos.Grid.distance( npc->GetMoveData().Pos.Grid ) < 10 )
		{
			//NpcCreateData& data = npc->GetNpcCreateData();

			//gNpcManager->TalkNpc( (SANpcType)npcData.Type , npc , player , msg );
		}
	}

	return GAME_NO_ERROR;
}
